package com.zyh.homeworkzhuantike;

public class Test6 {
    public static void main(String[] args) {
        /*
        有这样的一个数组，元素是{58,17,95,66,173,996,51,200}。求出该数组中满足要求的元素和，
        要求是：求和的元素个位和十位都不能是7，并且只能是偶数

         */
        int[] arr = {58, 17, 95, 66, 173, 996, 51, 200};
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            int g, s;
            g = i / 1 % 10;
            s = i / 10 % 10;
            if (g != 7 && s != 7 && i % 2 == 0) {
                sum = sum + arr[i];
                System.out.print(arr[i] + " ");
            }
        }
        System.out.println();
        System.out.println("sum = " + sum);
    }
}
